﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Wap/Agent/AgentSite.Master" AutoEventWireup="true" CodeBehind="BonusSummary.aspx.cs" Inherits="ZLCMS.Web.Wap.Agent.BonusSummary" %>

<%@ Register src="Footer.ascx" tagname="Footer" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="pages" runat="server">
<div data-role="page" id="mypage">

	<div data-role="header">
	</div><!-- /header -->

	<div role="main" class="ui-content">
     
    	<!--s top_title-->
        <div class="top_title">
        	<!--s tixian_jilu-->
            <div class="tixian_jilu">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td class="data"><input type="text" name="startDate" id="startDate" value="<%=string.Format("{0:yyyy-MM-dd}", Start) %>"</td>
                    <td class="tex">至</td>
                    <td class="data"><input type="text" name="endDate" id="endDate" value="<%=string.Format("{0:yyyy-MM-dd}", End) %>"/></td>
                    <td><a href="#" class="btn" onclick='queryData();'>过滤</a></td>
                  </tr>
                </table>
            </div>
            <!--e tixian_jilu-->
        </div>
        <!--s top_title-->

        <div class="top_title">总营业额<span id="sales"></span>，总提成<span id="bonus"></span></div>
    
        <!--s Sum-->
        <div class="Sum">
        	<table cellpadding="0" cellspacing="0" border="0" width="100%">
            <thead>
            	<tr>
                	<th>日期</th>
                    <th>营业额</th>
                    <th>提成</th>
                </tr>
            </thead>
            <tbody class="summaryData">
            </tbody>
            </table>
        </div>
        <!--e Sum-->
        
            	<a data-role="button" data-shadow="false" data-theme="o" id="moreBtn">加载更多</a>
  	</div><!-- /content -->

    <!--S footer -->
	<div data-role="footer" data-position="fixed" data-tap-toggle="false">
                <uc1:Footer ID="Footer1" runat="server" />    
    </div>
    <!--E footer -->
    
</div><!-- /page -->

<script src="/wap/lib/common/listviewHandler.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        queryData();
    });
    function queryData() {
        var handler = $('.summaryData').listviewHandler();
        handler.initialize({
            loaderBtn: $('#moreBtn'), //加载数据按钮（点击加载下一页）
            emptyHtml: '<tr><td colspan="3">无记录</td></tr>', //无记录时显示此html
            itemTemplate: '<tr>' +
                	'<td>{Date}</td>' +
                    '<td>{SalesAmount}</td>' +
                    '<td>{BonusAmount}</td>' +
                '</tr>', //项模板
            pageIndex: 1, //页码（从1起算）
            pageSize: 20, //页大小
            totalCount: 999, //总记录数
            itemHandler: function (data, itemTemplate, container) {//数据各项处理
                data.Date = data.Date.substr(0, 10);
                return itemTemplate.format(data);
            },
            beforeHandleResult: function (result, totalCount, container) {
                $('#bonus').text(result.BonusAmount);
                $('#sales').text(result.SalesAmount);
            },
            command: 'Agent.LoadBonusSummary',
            parameter: { AgentAccount: '<%=AgentAccount %>', Start: $('#startDate').val(), End: $('#endDate').val() }
        });
        handler.nextPage();
    }
</script>

</asp:Content>
